using System;
using System.Threading;
using Shraga.BLL;

namespace Shraga.Client
{
	/// <summary>
	/// Summary description for RefreshThread.
	/// </summary>
	public class RefreshThread
	{

		private int m_waitSecond = -1;
		public RefreshThread(int RefreshSecond)
		{
			m_waitSecond = RefreshSecond;
		}

		public void DoLoop()
		{
			while(true)
			{
				Thread.Sleep(new TimeSpan(0,0,m_waitSecond));
				OnTimer();
			}
		}

		private void OnTimer()
		{
			DBObjectsObserver.Instance().RefreshAll();
		}
	}
}
